REM: Save a Pdf as JPEG.
 REM:Also Multipage PDF will can be changed. Then every page will be saved as single JPEG
 REM: The Filename you can change to your needs.
 REM: If you use Drag&drop or Filename as command
 REM: line argument the script will work with this file.

'*********Settings in File**************************
FileNM = "C:\Users\muhe\Desktop\x.pdf" '//Filename for File to transfer if NO argument is given
'****************************************************

set WshShell = CreateObject ("Wscript.Shell")
set fs = CreateObject("Scripting.FileSystemObject")
Set objArgs = WScript.Arguments
if objArgs.Count = 1 then FileNM = ObjArgs(0)
Info = "Save as JPEG"&VbCr&_
       "File Name: "&FileNM &vbCr&" Delete existing JPEG FILES with the same Name before!"&vbcr&" Start now?"
OK = MsgBox(Info, vbQuestion+vbYesNo,"Insert Files") : if OK = vbNo then WScript.quit

'//Start or switch to Acrobat
WshShell.run "Acrobat.exe"
While not WshShell.AppActivate("Adobe Acrobat") : Wscript.Sleep 1000 : Wend
Set gApp = CreateObject("AcroExch.App")

if not fs.FileExists(FILENM) then
     MsgBox "Ups! " & FileNM & " doesn't exist? " & "Try new!", vbExclamation
     WScript.quit
end if

Set BASFL = CreateObject("AcroExch.pdDoc")
OK = BASFL.Open(FileNM) '//Open the PDF-File
if not OK Then if MsgBox("Error open Basic File") then Wscript.quit
BASFL.OpenAVDoc(mid(FileNM,InstrRev(FileNM,"\")+1)) '// get the PDF-File into view
WScript.Sleep 1000

'// to get this part working reliable(!) use WinAPI, WMI, or AutoITX.dll to check the forground window

WshShell.SendKeys "^+s" '// send keys for SaveAs
WScript.Sleep 1000
WshShell.SendKeys "{tab}" '// goto Filetype
WScript.Sleep 500
WshShell.SendKeys "J" '// switch filetype zu JPEG
WScript.Sleep 500
WshShell.SendKeys "{tab}{Enter}" '// switsch to "Save" and save
WScript.Sleep 1000

Set BASFL = nothing : set gApp = nothing
